package com.example.lib_mvicore.viewmodel

import androidx.lifecycle.ViewModel
import com.example.lib_mvicore.IIntent
import com.example.lib_mvicore.IViewModel
import kotlinx.coroutines.channels.Channel

/**
 * @author yaotianxue
 * @description
 * @date 2024/10/25
 */
abstract class BaseViewModel<I:IIntent>:IViewModel<I>,ViewModel() {
    protected val _intents = Channel<I>(Channel.UNLIMITED)
    override val intents: Channel<I>
        get() = _intents


    init {
        handleIntent()
    }

    /**
     * 根据不同的意图用户行为处理
     */
    abstract fun handleIntent()
}